<?php

/**
 * Description of editfoto
 *
 * @author laimis
 */
class EditPhoto extends ActionBase {

    public $title = 'Photo edit form';
    public $editWizard = 0;


    public function doEdit(){
        if($this->getPhotoService() != null){
            $photo = $this->photoService->getById($_POST['photo_id']);
            $photo->title = $_POST['title'];
            $photo->description = $_POST['description'];
            $this->photoService->save($photo);

        }
    }

    public function EditPhoto(){
        if(isset ($_POST['slectedPhoto'])){
            $this->editWizard = 1;
            include_once  BASEURL.'web/layout.php';
        }elseif (isset ($_POST['editPhoto'])){
            $this->doEdit();
            $_REQUEST['request']['object'] = 'gallery';
            $_REQUEST['request']['action'] = 'view';
            include_once BASEURL.'action/gallery/wrapper.php';
            new GalleryWrapper();
        }else{
            $this->editWizard = 0;
            include_once  BASEURL.'web/layout.php';
        }
    }

}

?>
